﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ecommerce.Web.Code;
using Ecommerce.Model;

namespace Ecommerce.Web.UserControl
{
    public partial class ProgressoCheckout : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            }
        }

        public void CarregarDadosPedido()
        {
            lblFrete.Text = Carrinho.Instance.Frete.ToString("c");
            lblPeso.Text = Carrinho.Instance.PesoTotal.ToString() + "kg";
            lblSubtotal.Text = Carrinho.Instance.SubTotal.ToString("c");
            lblTotal.Text = Carrinho.Instance.Total.ToString("c");
        }

        public void CarregarEnderecoEntrega()
        { 
            var endereco = EnderecoModel.Instance.Obter(Carrinho.Instance.IdentificadorEndereco);

            lblBairro.Text = endereco.end_des_bairro;
            lblCEP.Text = endereco.end_num_cep;
            lblCidade.Text = endereco.end_nom_cidade;
            lblEstado.Text = endereco.end_sig_uf;
            lblLogradouro.Text = endereco.end_nom_logradouro;
            lblNumero.Text = endereco.end_num_endereco.ToString();
        }

        public void MostrarDadosEndereco(bool mostrar)
        {
            dvEnderecoEntrega.Visible = mostrar;
        }
    }
}